<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>excutor</title>
</head>
<body>
    <script>
        let P = Promise.resolve(222);
        //如果传入的参数为非promise类型的对象，则返回的结果为成功的promise对象
        console.log(P);
        //如果传入的参数为promise类型的对象，则promise对象返回的结果决定了resolve方法返回的是失败还是成功的
        let P2 = Promise.resolve(new Promise((resolve,reject) => {
            resolve("ok")
        }));
        console.log(P2);
        let P3 = Promise.resolve(new Promise((resolve,reject) => {
            reject("error")
        }));
        P3.catch(reason => {
            console.log(reason)
        });
        console.log(P3);
    </script>
</body>
</html>